package com.bcn.login_mybatisplus_demo.meal.service.impl;

import java.util.List;

import com.bcn.login_mybatisplus_demo.interceptor.AuthStorage;
import com.bcn.login_mybatisplus_demo.meal.domain.TAppMeal;
import com.bcn.login_mybatisplus_demo.meal.mapper.TAppMealMapper;
import com.bcn.login_mybatisplus_demo.meal.service.ITAppMealService;
import com.bcn.login_mybatisplus_demo.util.Convert;
import com.bcn.login_mybatisplus_demo.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author administrator
 * @date 2025-03-18
 */
@Service
public class TAppMealServiceImpl implements ITAppMealService
{
    @Autowired
    private TAppMealMapper tAppMealMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param id 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public TAppMeal selectTAppMealById(Long id)
    {
        return tAppMealMapper.selectTAppMealById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param tAppMeal 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<TAppMeal> selectTAppMealList(TAppMeal tAppMeal)
    {
        tAppMeal.setUserId(AuthStorage.getUser().getId());
        return tAppMealMapper.selectTAppMealList(tAppMeal);
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param tAppMeal 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertTAppMeal(TAppMeal tAppMeal)
    {
        tAppMeal.setCreateTime(DateUtils.getNowDate().toString());
        tAppMeal.setUserId(AuthStorage.getUser().getId());
        return tAppMealMapper.insertTAppMeal(tAppMeal);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param tAppMeal 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateTAppMeal(TAppMeal tAppMeal)
    {
        return tAppMealMapper.updateTAppMeal(tAppMeal);
    }

    /**
     * 删除【请填写功能名称】对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTAppMealByIds(String ids)
    {
        return tAppMealMapper.deleteTAppMealByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param id 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteTAppMealById(Long id)
    {
        return tAppMealMapper.deleteTAppMealById(id);
    }
}
